package com.woniuxy.factory.service.imp;

import com.woniuxy.factory.entity.Process;
import com.woniuxy.factory.mapper.ProcessMapper;
import com.woniuxy.factory.service.ProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProcessServiceImp implements ProcessService {

    @Autowired(required = false)
    ProcessMapper pm;

    //查询所有工序
    @Override
    public List<Process> selectProcessAll(Process process,int page, int limit) {
        //设置起始索引
        page=(page-1)*limit;
        List<Process> lp = pm.selectProcessAll(process,page,limit);
        return lp;
    }

    //查询所有工序的总数目
    @Override
    public int selectProcessCounts(Process process) {
        int count = pm.selectProcessCounts(process);
        return count;
    }

    //添加工序
    @Override
    public void insertProcess(Process p) {
        pm.insertProcess(p);
    }

    //编辑当前id工序数据回显
    @Override
    public Process selectProcessById(String pssId) {
        Process process = pm.selectProcessById(pssId);
        return process;
    }

    //通过id删除工序
    @Override
    public void deleteProcessById(int id) {
        pm.deleteProcessById(id);
    }

    //修改工序信息
    @Override
    public void updateProcess(Process process) {
        pm.updateProcess(process);
    }

    //删除选中的数据
    @Override
    public void deleteProcessByIdsService(int[] pid) {
            pm.deleteProcessByIds(pid);

    }
}
